package com.mallcloud.mall.mall.api.entity.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import java.util.Date;
import java.util.Optional;

@ApiModel(value = "ProSignIn", description = "会员签到")
@Data
@ToString
public class ProSignIn {

	@ApiModelProperty("签到手机")
	private String mobile;
	@ApiModelProperty("签到日期")
	private Date signDate = new Date();
	@ApiModelProperty("赠送积分类型，1：签到赠送积分，2，其他方式赠送积分")
	private String givenType = "1";
	@ApiModelProperty("赠送积分说明")
	private String memo = "小程序签到";

	@ApiModelProperty(value = "返回id 0-签到成功 1-签到失败", hidden = true)
	private Integer messageId;
	@ApiModelProperty(value = "返回信息", hidden = true)
	private String message;
	@ApiModelProperty(value = "签到成功返回积分", hidden = true)
	private Long rtPoint;

	public boolean isSuccess() {
	    return Optional.ofNullable(this.messageId).map(x -> x.equals(0)).orElse(false);
	}
}
